//
//  Myorder.m
//  LoveFreshBeen
//
//  Created by vinsent on 16/10/16.
//  Copyright © 2016年 魏根. All rights reserved.
//

#import "Myorder.h"
#import "StatusModel.h"
//#import "ButtonsModel.h"
#import <YYModel.h>

@implementation Myorder 



//+ (instancetype)sharedOrder {
//    
//    static Myorder *instance;
//    static dispatch_once_t onceToken;
//    dispatch_once(&onceToken, ^{
//       instance  = [[Myorder alloc] init];
//    });
//    return instance;
//}


- (void)setOrder_goods:(NSArray *)order_goods {
   
    NSMutableArray *mArr = [NSMutableArray array];
    for (NSArray *zArr in order_goods) {
        NSDictionary *dict = zArr.firstObject;
             
        OrderGoodModel *orderGoodM = [[OrderGoodModel alloc] init];
        [orderGoodM yy_modelSetWithDictionary:dict];
        
        [mArr addObject:orderGoodM];
    }
     _order_goods = [mArr copy];
}

- (void)setButtons:(NSArray<ButtonsModel *> *)buttons {
    NSMutableArray *mArr = [NSMutableArray array];
    for (NSDictionary *dict in buttons) {
         
            ButtonsModel *orderGoodM = [[ButtonsModel alloc] init];
        
        //有时使用YYModel不能正确转换成模型(暂时不知道原因)    ✨✨✨✨
        //(爱鲜蜂)
//            [orderGoodM yy_modelSetWithDictionary:dict];
        [orderGoodM setValuesForKeysWithDictionary:dict];
            
            [mArr addObject:orderGoodM];
        
    }
    _buttons = [mArr copy];
}

- (void)setStatus_timeline:(NSArray *)status_timeline {
    NSMutableArray *mArr = [NSMutableArray array];
    for (NSDictionary *dict in status_timeline) {
        StatusModel *statuses = [[StatusModel alloc] init];
        [statuses setValuesForKeysWithDictionary:dict];
        [mArr addObject:statuses];
    }
    _status_timeline = [mArr copy];
}

- (void)setFee_list:(NSArray<FeeModel *> *)fee_list {
    NSMutableArray *mArr = [NSMutableArray array];
    for (NSDictionary *dict in fee_list) {
        FeeModel *statuses = [[FeeModel alloc] init];
        [statuses setValuesForKeysWithDictionary:dict];
        [mArr addObject:statuses];
    }
    _fee_list = [mArr copy];
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key {}

//+ (NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass {
//    return @{@"buttons" : [ButtonsModel class]};
//}


@end
